/**
 * Created by Administrator on 2016/7/22 0022.
 */

$(document).ready(function(){
    var browser = navigator.appName;
    var b_version = navigator.appVersion;
    var version = b_version.split(";");
    var trim_Version = version[1].replace(/[ ]/g, "");
    if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE6.0") {
        swiper_start();
        swiper_num();
        swiper_teb();
    }
    else if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE7.0") {
        swiper_start();
        swiper_num();
        swiper_teb();
    }
    else if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE8.0") {
        swiper_start();
        swiper_num();
        swiper_teb();
    } else if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE9.0") {
        swiper_start();
        swiper_num();
        swiper_teb();
    }else {
        four_btn();
    }
});

function four_btn(){
    var elem_btn = $(".four-bottom-btn");
    elem_btn.each(function(index){
        $(this).click(function(){
            var obj;
            var obj_now;
            elem_btn.each(function(){
                $(this).css({"background-color":"transparent","color":"#a4a4a4"})
            });
            $(this).css({"background-color":"#e1515b","color":"#fff"});
            elem_btn.unbind();
            $(".four-bottom-content").each(function(i){
                if(i==index && $(this).css("display")!="block"){
                    obj_now = $(this);
                    obj_now.css({"opacity":"0","display":"block"})
                }else if(i!=index && $(this).css("display")=="block") {
                    obj = $(this);
                }else {
                    four_btn();
                }
            });
            obj_now.animate({"opacity":"1"},400);
            obj.animate({"opacity":"0"},400,function(){
                obj.css("display","none");
                four_btn();
            })
        })
    })
}

function swiper_start(){
    $(".four-bottom-contentIE").each(function(index){
        if(index == 0){
            $(this).css("display","block");
        }else{
            $(this).css("display","none");
        }
    });
    $(".IE-content-num").find("div").each(function(index){
              if(index == 0){
                  $(this).css("color","#4c4743");
              }else if(index==3){
                  $(this).css("color","#4c4743");
              }
    });
    $(".IE-content").each(function(index){
        if(index == 0){
            $(this).css("display","block");
        }else if(index==3){
            $(this).css("display","block");
        }
    })
}
function swiper_num(){
    $(".IE-content-num").find("div").each(function(index){
        $(this).click(function(){
            $(".IE-content-num").find("div").each(function(y){
                if(index<3){
                    if(y == index){
                        $(this).css("color","#4c4743");
                    }else if(y<3&&y!=index){
                        $(this).css("color","#e1515b")
                    }
                }else if(index>=3){
                    if(y == index){
                        $(this).css("color","#4c4743");
                    }else if(y>=3&&y!=index){
                        $(this).css("color","#e1515b")
                    }
                }

            });
            $(".IE-content").each(function(i){
                if(index<3){
                    if(i == index){
                        $(this).css("display","block");
                    }else if(i<3&&i!=index){
                        $(this).css("display","none")
                    }
                }else if(index>=3){
                    if(i == index){
                        $(this).css("display","block");
                    }else if(i>=3&&i!=index){
                        $(this).css("display","none")
                    }
                }
            })
        })
    });
}

function swiper_teb(){
    $(".four-bottom-btn").each(function(index){
        $(this).click(function(){
              $(".four-bottom-contentIE").each(function(i){
                  if(i == index){
                      $(this).css("display","block");
                  }else{
                      $(this).css("display","none");
                  }
              });
            $(".four-bottom-btn").each(function(y){
                   if(y==index){
                       $(this).css({"background-color":"#e1515b","color":"#fff"});
                   }else {
                       $(this).css({"background-color":"transparent","color":"#a4a4a4"})
                   }
            })
        })
    })
}